<template>
	<view class="body">
		
		<view class="goodbox"  v-for="item in lists">
			
			<viwe class="good_status">
				<view class="good_status1"> {{item.status==1?'通过':'审核中'}} </view>
				<view class="good_status2" >
					<text @tap="deletegood" :data-id="item.id" v-if="item.status!=1" class="iconfont icon-shanchu1"></text>
				</view>
			</viwe>
			
			<view class="goodlibox" @tap="saveinfo" :data-id="item.id">
			
				<image class="good_image" :src="item.image" mode="aspectFill"></image>
				
				<view class="goodli_more">
					
					<view class="goodli_title font1">
						{{item.name}}
					</view>
					
					<view class="goodli_mongy1">
						¥ {{item.money}}
					</view>
					<view class="goodli_mongy">
						发布 {{item.times}}
					</view>
				</view>
		
			</view>
			<view style="height: 20rpx;"></view>
		</view>
		
		</view>
	</view>
</template>

<script>
	
	import {curl} from 'common/api.js';
	import {baseUrl} from "common/config.js";
	export default {
		data() {
			return {
				array:['选择1','选择2','选择3'],
				index:0,
				lists:[]
			}
		},
		
		onLoad() {
			
			this.getmygoods();
			
		},
		
		onShareAppMessage(res) {
			
		},
		methods: {
			saveinfo(ret){
				console.log(ret);
				var id=ret.currentTarget.dataset.id;
				
				// uni.navigateTo({
				// 	url:"/pages/mygood/set?id="+id
				// })
			},
			
			deletegood(ret){
				console.log(ret);
				var id=ret.currentTarget.dataset.id;
				var that=this;
				
				uni.showModal({
					title:'提示',
					content:'您确定要删除此项吗?',
					success: function (res) {
						if (res.confirm) {
						
							curl('goods/deletegoods', {id:id}).then((res) => {
								console.log(res.data);
								that.getmygoods();
							});
						
						} 
					}
				})
				
			},
			getmygoods(){
				var that=this;
				curl('goods/getmygoods', {}).then((res) => {
					console.log(res.data);
					that.lists=res.data;
				});
				
			}
			
		}
	}
</script>

<style>
	
	.goodli_mongy1{
		height: 35rpx;line-height: 35rpx;color: orangered;font-size: 24rpx;
	}
	.goodli_mongy{
		height: 35rpx;line-height: 35rpx;color: #666666;font-size: 24rpx;
	}
	.goodli_title{
		height: 50rpx;font-size: 28rpx;font-weight: 500;
	}
	.goodli_more{
		width: 520rpx;height: 120rpx;
	}
	.good_image{
		width: 120rpx;height: 120rpx;border-radius: 10rpx;
		margin-right: 20rpx;
	}
	.goodlibox{
		width: 710rpx;height: 160rpx;margin: auto;
		display: flex;align-items: center;
	}
	.good_status2>text{
		font-size: 28rpx !important;
	}
	.goodbox{
		width: 750rpx;height: auto;
		border-bottom: 1px solid #ececec;
	}
	.good_status{
		width: 710rpx;height: 50rpx;margin: auto;
		display: flex;align-items: center;justify-content: space-between;
	}
	.good_status1{
		font-size: 28rpx;color: #333333;
	}

</style>
